<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class LoginHome extends Model
{
    use HasFactory;

    protected $table = "new_admin";
    public $timestamps = false;
    protected $guarded = [];

    public static function LoginModel(string $where)
    {
        try {
            $res = self::where("password",$where)
                ->select()
                ->first();
            if (empty($res)){
                throw new \Exception("密码有错误");
            }
            return $res;
        }catch (\Exception $e)
        {
        return ['code'=>520,'msg'=>"密码有错误",'data'=>$res];
        }




    }
}
